{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set script_controller = 'system/mailer' %}

{% set menu = 'admin_setting_mailer' %}

{% block main %}
  {% if is_trial() %}
    <div class="row form-group">
      <div class="help-block">
        </br></br>
        <script>
          var _hmt = _hmt || [];
        </script>
        <script charset="utf-8" src="http://wpa.b.qq.com/cgi/wpa.php"></script>

        <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
        <p style = "text-align:center;font-size:16px">当前版本为试⽤版,不能进⾏邮件服务设置。如需购买授权版,请联系销售人员。 
        电话：0571-86819929 或 
        <span id="BizQQWPA" onclick="_hmt.push(['_trackEvent', 'advisory', 'click', 'qq'])"><a id="BizQQWPA" href="javascript:" style='text-decoration:none;'>QQ：800023860 </a>。</span>
        </p>
        <script type="text/javascript">
            BizQQWPA.addCustom({aty: '0', a: '0', nameAccount: 800023860, selector: 'BizQQWPA'}); 
        </script>
        </br>
      </div>
    </div>
  {% else %}
    {{ web_macro.flash_messages() }}
    <form class="form-horizontal" method="post" id="mailer-form" {#hidden="hidden"#}novalidate>
      <div class="row form-group">
        <div class="col-md-3 control-label">
          <label >邮件发送</label>
        </div>
        <div class="controls col-md-8 radios">
          {{ radios('enabled', {1:'开启', 0:'关闭'}, mailer.enabled) }}
          <p class="help-block">需要登录邮箱，并在邮箱设置中开启smtp服务才能发送验证邮件</p>
        </div>
      </div>

      <div class="row form-group">
        <div class="col-md-3 control-label">
          <label for="host">SMTP服务器地址</label>
        </div>
        <div class="controls col-md-8">
          <input type="text" id="host" name="host" class="form-control" value="{{mailer.host}}">
          <p class="help-block"> 每种邮箱的地址都不相同，请根据使用的邮箱类型，查找邮箱服务器地址，如：smtp.yourmail.com</p>
        </div>
      </div>
      <p></p>
      <div class="row form-group">
        <div class="col-md-3 control-label">
          <label for="port">SMTP端口号</label>
        </div>
        <div class="controls col-md-8">
          <input type="text" id="port" name="port" class="form-control" value="{{mailer.port}}">
          <p class="help-block">通常端口号为25</p>
        </div>
      </div>
     <p></p>
      <div class="row form-group">
        <div class="col-md-3 control-label">
          <label for="username" >SMTP用户名</label>
        </div>
        <div class="controls col-md-8">
          <input type="text" id="username" name="username" class="form-control" value="{{mailer.username}}">
          <p class="help-block">正确格式应为abc@mail.com</p>
        </div>
      </div>
     <p></p>

      <div class="row form-group">
        <div class="col-md-3 control-label">
          <label for="password" >SMTP密码</label>
        </div>
        <div class="controls col-md-8">
          <input type="password" id="password" name="password" class="form-control" value="{{mailer.password}}">
          <p class="help-block">smtp密码：即邮箱密码/客户端授权密码</p>
        </div>
      </div>
     <p></p>

     <div class="row form-group">
        <div class="col-md-3 control-label">
          <label for="from" >发信人地址</label>
        </div>
        <div class="controls col-md-8">
          <input type="text" id="from" name="from" class="form-control" value="{{mailer.from}}">
          <p class="help-block">正确格式应为abc@mail.com</p>
        </div>
      </div>
     <p></p>

     <div class="row form-group">
        <div class="col-md-3 control-label">
          <label for="name" >发信人名称</label>
        </div>
        <div class="controls col-md-8">
          <input type="text" id="name" name="name" class="form-control" value="{{mailer.name}}">
        </div>
      </div>
     <p></p>
      <div class="row form-group">
        <div class="col-md-3 control-label"></div>
        <div class="controls col-md-8">
          <button type="submit" class="btn btn-primary">提交</button>
        </div>
      </div>
      <input type="hidden" name="email-setting-status" value="{{status}}">
      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
    </form>

  {% endif %}
{% endblock %}